#include "server.hpp"
#include "daemon.hpp"

void user_mandb()
{
    std::cout << "error command, please input like:  \"./server port\" " << std::endl;
}

int main(int args, char *argc[])
{
    if (args != 2)
    {
        user_mandb();
    }

    TCP_SERVER *tcpserver = new TCP_SERVER(atoi(argc[1]));

    tcpserver->init();

    //把服务器进程设置为守护进程
    daemon_process();
    tcpserver->start();
    
    delete tcpserver;
    return 0;
}